﻿using infoMECHANICA.NHibernateORM.TestMappings;
using NHibernate.Criterion;

namespace infoMECHANICA.NHibernateORM.ExampleProgram
{
    /// <summary>
    /// See http://www.codeplex.com/nhcb/Wiki/View.aspx?title=ONE_TO_MANY_QUERIES&referringTitle=Home for details
    /// </summary>
    public class Example2 : IExample
    {
        #region IExample Members

        public string Title
        {
            get { return "Example 2 - One-to-many relationships"; }
        }

        public DetachedCriteria ComposeCriteria()
        {
            //get all employees from "Groogle" company on condition that employee salary is greater than 1200
            EmployeeRec employeeRec = new EmployeeRec();
            employeeRec.Salary.SetGt(12000);
            employeeRec.Company.Name.SetEq("Groogle");

            return employeeRec.BuildCriteria();
        }

        #endregion
    }
}
